﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RoleMenber.aspx.cs" Inherits="BySoft.Web.Site.SysManage.RoleMenber"
    MasterPageFile="~/MastePage/SubEmptyMaster.Master" %>

<%@ Register Assembly="OneSoft.Web" Namespace="OneSoft.Web.UI.WebControls" TagPrefix="asp" %>
<%@ Register Assembly="BySoft.Web.Controls" Namespace="BySoft.Web.Controls" TagPrefix="cc1" %>
<asp:Content ID="cphContent" runat="server" ContentPlaceHolderID="EmptyMasteCPH">
    <script language="javascript" type="text/javascript">
        function CheckAll(con) {

            var dom = document.getElementById("<%=sgvMember.ClientID %>").getElementsByTagName("*");

            for (i = 0; i < dom.length; i++) {
                if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                    dom[i].checked = document.getElementById(con.id).checked;
                }
            }

        }

        function CheckSingle(con) {
            var dom = document.getElementById("<%=sgvMember.ClientID %>").getElementsByTagName("*");
            if (!document.getElementById(con.id).checked) {
                for (i = 0; i < dom.length; i++) {
                    if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                        dom[i].checked = false;
                        break;
                    }
                }
            }
            else {
                var choose = true;
                var first = true;
                for (i = 0; i < dom.length; i++) {
                    if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                        if (first == false) {
                            if (dom[i].checked == false) {
                                choose = false;
                                break;
                            }
                        }
                        else {
                            first = false;
                        }
                    }
                }

                for (i = 0; i < dom.length; i++) {
                    if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                        dom[i].checked = choose;
                        break;
                    }
                }
            }
        }
    </script>
    <h1 class="tit">
        系统管理 >> 成员选择</h1>
    <div class="searchTable">
        <table cellpadding="0" cellspacing="0">
            <tr>
                <th width="20%">
                    账号：
                </th>
                <td width="30%">
                    <asp:TextBox ID="txtId" runat="server" CssClass="text ui-widget-content ui-corner-all"></asp:TextBox>
                </td>
                <th width="20%">
                    名称：
                </th>
                <td width="30%">
                    <asp:TextBox ID="txtName" runat="server" CssClass="text ui-widget-content ui-corner-all"></asp:TextBox>
                </td>
            </tr>
        </table>
    </div>
    <%--列表--%>
    <div class="tableStyle">
        <div style="width: 100%; text-align: right">
            <label class="btnStyleb png_bg">
                <asp:Button Text="查询" runat="server" ID="btnSearch" OnClick="btnQuery_Click" Width="60px" />
            </label>
        </div>
        <asp:SGridView runat="server" ID="sgvMember" Width="100%" ShowActionToolBar="false"
            AutoGenerateColumns="false" AllowCascade="false" DataKeyNames="ID">
            <Columns>
                <asp:TemplateField>
                    <ItemStyle Width="15%" />
                    <HeaderStyle Width="15%" />
                    <HeaderTemplate>
                        <asp:CheckBox ID="cbAll" runat="server" onclick="CheckAll(this)" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="cbChoose" runat="server" onclick="CheckSingle(this)" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="LOGINID" HeaderText="账号" ItemStyle-Width="20%" HeaderStyle-Width="20%" />
                <asp:BoundField DataField="NAME" HeaderText="姓名" ItemStyle-Width="20%" HeaderStyle-Width="20%" />
            </Columns>
        </asp:SGridView>
        <div style="padding-top: 5px" align="right">
            <cc1:PagingControl ID="pcData" runat="server" MaxNavigatePageCount="6" OnPageIndexClick="pcData_PageIndexClick" />
        </div>
    </div>
    <div class="controlBar" align="center">
        <table cellpadding="0" cellspacing="0" style="width: 140px; margin: 0 auto;">
            <tr>
                <td width="30%">
                    <label class="btnStylec png_bg">
                        <asp:Button ID="btnOk" runat="server" Text="确定" OnClick="btnOk_Click" Width="60px" />
                    </label>
                    <label class="btnStyleb png_bg">
                        <input type="button" id="btnCancel" value="返回" onclick="CloseTopDialog();" style="width: 60px;" />
                    </label>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
